C1.LiveLinq.Indexing Namespace > ScannerCollection<T> Class > Add Method : Add<TKey>(Expression<Func<T,TKey>>,Boolean,Boolean,IndexingAlgorithm,CultureInfo) Method |
'Declaration
Public Overloads Function Add(Of TKey)( _ ByVal keySelector As System.Linq.Expressions.Expression(Of Func(Of T,TKey)), _ ByVal keyIsUnique As System.Boolean, _ ByVal onlyOnce As System.Boolean, _ ByVal algorithm As IndexingAlgorithm, _ ByVal locale As System.Globalization.CultureInfo _ ) As IIndexScanner(Of T,TKey)
public IIndexScanner<T,TKey> Add<TKey>( System.Linq.Expressions.Expression<Func<T,TKey>> keySelector, System.bool keyIsUnique, System.bool onlyOnce, IndexingAlgorithm algorithm, System.Globalization.CultureInfo locale )
A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique.
But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the indexed collection. An attempt to modify the indexed collection violating the uniqueness throws an System.InvalidOperationException.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2